<HTML><HEAD><TITLE>set_flag(++PredSpec, +Flag, +Value)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Predicate Database and Compiler</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>set_flag(++PredSpec, +Flag, +Value)</H1>
Sets the flag Flag of the procedure specified by PredSpec to the value
Value.


<DL>
<DT><EM>PredSpec</EM></DT>
<DD>Expression of the form Atom/Integer or a list of those.
</DD>
<DT><EM>Flag</EM></DT>
<DD>Atom.
</DD>
<DT><EM>Value</EM></DT>
<DD>Atom.
</DD>
</DL>
<H2>Description</H2>
   Used to set the value Value of the flag Flag of the procedure(s)
   specified by PredSpec.  The value of a flag may be returned using
   get_flag/3.

<P>
   The settable flags, their values and their meanings are:

<P>
<PRE>
   ---------------------------------------------------------------------
   | Flags          Values     Description                             |
   |-------------------------------------------------------------------|
   | deprecated     on, off    predicate is deprecated, warn on use    |
   |                                                                   |
   | leash                     debugger behaviour for this procedure:  |
   |                stop,        trace procedure's ports and stop      |
   |                print,       trace procedure's ports and continue  |
   |                notrace      hide procedure's ports                |
   |                                                                   |
   | skip           on, off    procedure will be traced,               |
   |                           but its children will not               |
   |                                                                   |
   | spy            on, off    procedure has a spypoint                |
   |                                                                   |
   | start_tracing  on, off    procedure starts the tracer             |
   |                                                                   |
   | priority       1..12      default waking priority                 |
   ---------------------------------------------------------------------
</PRE>

<H3>Modes and Determinism</H3><UL>
<LI>set_flag(++, +, +) is det
</UL>
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>At least one of PredSpec, Flag or Value are not instantiated
<DT><EM>(5) type error </EM>
<DD>PredSpec is not an expression of the form Atom/Integer.
<DT><EM>(5) type error </EM>
<DD>Flag is not an atom.
<DT><EM>(5) type error </EM>
<DD>Value is not an atom.
<DT><EM>(6) out of range </EM>
<DD>Flag is no flag.
<DT><EM>(6) out of range </EM>
<DD>Value is no value of the flag Flag.
<DT><EM>(30) trying to write a read-only flag </EM>
<DD>Flag is a read only flag.
<DT><EM>(60) referring to an undefined procedure </EM>
<DD>PredSpec is not defined.
</DL>
<H2>Examples</H2>
<PRE>
Success:
    [eclipse]: [user].
     pr([]).  % prints the elements of a list
     pr([ S | T ]) :-
            writeln(S),
            pr(T).
     user compiled 484 bytes in 0.00 seconds
    yes.
    [eclipse]: pr([tom, dick]).
    tom
    dick
    yes.
    [eclipse]: set_flag(pr/1, spy, on).
    yes.
    [eclipse]: trace.
    Debugger switched on - creep mode
    yes.
    [eclipse]: pr([tom, dick]).
     +(1) 0  CALL   pr([tom, dick]) (dbg)?- leap
    tom
     +(3) 1  CALL   pr([dick]) (dbg)?- leap
    dick
     +(5) 2  CALL   pr([]) (dbg)?- leap
     +(5) 2  EXIT   pr([]) (dbg)?- leap
     +(3) 1  EXIT   pr([dick]) (dbg)?- leap
     +(1) 0  EXIT   pr([tom, dick]) (dbg)?- leap
    yes.

Error:
    set_flag(X, skip, on).                 (Error 4).
    set_flag("a", spy, on).                (Error 5).
    set_flag(is/2, spy, yes).              (Error 6).
    set_flag(p/2, leash, on).              (Error 60).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/debug/debug-0.html">debug / 0</A>, <A HREF="../../kernel/compiler/get_flag-3.html">get_flag / 3</A>, <A HREF="../../kernel/compiler/deprecated-2.html">deprecated / 2</A>, <A HREF="../../kernel/debug/nospy-1.html">nospy / 1</A>, <A HREF="../../kernel/env/pred-1.html">pred / 1</A>, <A HREF="../../kernel/debug/skipped-1.html">skipped / 1</A>, <A HREF="../../kernel/debug/spy-1.html">spy / 1</A>, <A HREF="../../kernel/debug/trace-0.html">trace / 0</A>, <A HREF="../../kernel/debug/traceable-1.html">traceable / 1</A>, <A HREF="../../kernel/debug/unskipped-1.html">unskipped / 1</A>, <A HREF="../../kernel/debug/untraceable-1.html">untraceable / 1</A>
</BODY></HTML>
